package com.wxl.controller;

import com.wxl.entity.TOrder;
import com.wxl.service.TOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    private TOrderService tOrderService;

    @PostMapping("/orders")
    public String createOrder(@RequestParam String product) {
        return tOrderService.createOrder(product);
    }

    @GetMapping("/order")
    public TOrder getOrder(@RequestParam Long orderId) {
        return tOrderService.getOrder(orderId);
    }
}
